package com.my.serviceimpl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.my.bean.*;
import com.my.mapper.AlreadyAppointmentMapper;
import com.my.mapper.ExternalAlreadyMapper;
import com.my.service.AlreadyAppointmentService;
import com.my.service.ExternalAlreadyService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 已经预约产康项目安排 服务实现类
 * </p>
 *
 * @author 闫亚茹
 * @since 2018-08-31
 */
@Service
public class ExternalAlreadyServiceImpl extends ServiceImpl<ExternalAlreadyMapper, ExternalAlready> implements ExternalAlreadyService {

    @Autowired
    ExternalAlreadyMapper externalAlreadyMapper;


    /**
     * 查询
     * @return
     */
    public List<ExternalAlready> selectResult(){
        return  externalAlreadyMapper.selectResultMap();
    }

    /**
     * 查询房间id
     * @return
     */
    public List<ExternalAlready> selectHomeId(){
        return externalAlreadyMapper.selectResultMap();
    }

    /**
     * 根据id查询
     * @param id
     * @return
     */
    public List<ExternalAlready> selectHomeById(Long id){
        return externalAlreadyMapper.selectHomeById(id);
    }

    /**
     * 批量添加
     * @return
     */
    public List<ExternalAlready> bathInsert(){
        return externalAlreadyMapper.bathInsert();
    }


    /**
     * 查询并分页
     * @param map
     * @param voPage
     * @return
     */
    @Override
    public ResultPage<ExternalAlready> selectMyPage(Map map, VoPage voPage) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("page", (voPage.getPage() - 1)*voPage.getLimit());
        paramMap.put("limit", voPage.getLimit());
        List<ExternalAlready> list = baseMapper.selectMyPage(map,paramMap);
        Integer count = baseMapper.countMyPage(map,paramMap);
        ResultPage<ExternalAlready> resultPage=new ResultPage<>();
        resultPage.setCode(0);
        resultPage.setCount(count);
        resultPage.setMsg("成功");
        resultPage.setData(list);
        return resultPage;
    }
    @Override
    public List<ExternalAlready> selectMyPage() {
        return null;
    }

}




